package cn.tedu.charging.order.controller;

import cn.tedu.charging.common.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.tedu.charging.order.pojo.param.OrderAddParam;
import cn.tedu.charging.order.service.OrderService;

/**
 * @Author: Miyako
 * @Date: 2024-10-12-15:37
 * @Description: 创建订单
 */
@Api("订单功能")
@RestController
@RequestMapping("/order")
public class OrderController {


    @Autowired
    OrderService orderService;

    /**
     * @param:
     * @return:
     * @description:
     **/

    @ApiOperation("创建订单")
    @PostMapping("create")
    public JsonResult<String> orderCreate(@RequestBody OrderAddParam orderAddParam){
       String orderNo = orderService.oderCreate(orderAddParam);
        JsonResult<String> jsonResult = new JsonResult<>();
        jsonResult.setCode(2000);
        jsonResult.setMsg("sucess");
        jsonResult.setData(orderNo);
        return jsonResult;
    }

}
